﻿//-----------------------------------------------------------------------
// <copyright>
// This file is subject to the terms and conditions of the Microsoft Public License (MS-PL).
// See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL for more details.
// </copyright>
//----------------------------------------------------------------------- 
using Fulcrum.ControlGenerator;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Fulcrum.UnitTests.ControlGenerator
{
    [TestClass]
    public class RoutedCommandDataContextTests
    {
        public RoutedCommandDataContextTests()
        {
            // nothing
        }

        [TestMethod]
        public void TestCommandName()
        {
            var config = CreateConfig();

            var routedCommand = CreateDataContext(config);

            Assert.AreEqual("BazCommand", routedCommand.CommandName);

        }

        private static RoutedCommandDataContext CreateDataContext(MockRoutedCommandBindingConfiguration config)
        {
            var routedCommandBinding = new RoutedCommandBindingDataContext(config, config.OwningType);
            var routedCommand = new RoutedCommandDataContext(routedCommandBinding);

            return routedCommand;
        }

        [TestMethod]
        public void TestName()
        {
            var config = CreateConfig();

            var routedCommand = CreateDataContext(config);

            Assert.AreEqual("Baz", routedCommand.Name);

        }

        [TestMethod]
        public void TestSummary()
        {
            var config = CreateConfig();
            config.Summary = "some text";

            var routedCommand = CreateDataContext(config);

            Assert.AreEqual("some text", routedCommand.Summary);

        }

        private static MockRoutedCommandBindingConfiguration CreateConfig()
        {
            var config = new MockRoutedCommandBindingConfiguration();
            config.Name = "Baz";

            return config;
        }
    }
}
